#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QtCharts>
#include <QVBoxLayout>
#include <QTimer>
#include <QtMqtt/QMqttClient>
#include <QtMqtt/QMqttTopicName>

QT_BEGIN_NAMESPACE
namespace Ui {
class Widget;
}
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private slots:
    void on_horizontalSlider_speed_valueChanged(int value);

    void on_horizontalSlider_speed_sliderReleased();

    void on_pushButton_auto_mode_clicked();

    void on_checkBox_customize_endTime_clicked();

    void on_pushButton_timer_mode_clicked();

private:
    Ui::Widget *ui;
    double temperature;
    double humidity;
    QMqttClient* mqtt_client;
    QTimer* timer_auto_mode;
    QTimer* timer_time_mode;
    QTcpSocket* socket_get_ai_answer;
    QProcess* process_hunyuan;

    void chart_init();

    QVBoxLayout* layout_temperature;
    QVBoxLayout* layout_humidity;

    QChart *chart_temperature;
    QLineSeries *series_temperature;
    QChartView *chartView_temperature;

    QChart *chart_humidity;
    QLineSeries *series_humidity;
    QChartView *chartView_humidity;
    QDateTimeAxis* axisX_temperature;
    QDateTimeAxis* axisX_humidity;

    void chart_temperature_init();
    void chart_humidity_init();
    void mqtt_init();
    void DateTimeEdit_init();
    void socket_init();
    void socket_delete();
};
#endif // WIDGET_H
